#!/bin/bash

###################
# 说明: 此文件的作用是, 修改mock数据, 进行完整流程测试
#      不影响任何功能
# 用法:
#      ./mock_data.sh
#
#
###################
#set -x
cd `dirname $0`
_old_dir=$PWD

# mock data 所在的位置
cd ../adapter-service/src/test/resources/mock/moby/flow

prefix1=test_108
prefix2=test_109
vehicle1=0000002967
vehicle2=0000002968

# mac sed inline edit
# https://stackoverflow.com/questions/7573368/in-place-edits-with-sed-on-os-x?rq=1
# sed -i '' 's/oldword/newword/' file1.txt
#      ^ note the space

ls . | while read line; do
    if [[ "$line" == step_*.json ]]; then
        echo $line;
        sed -i '' -e 's/"idType": "1"/"idType": "1",/g' $line

        # 替换前缀
#        sed -i.bak -e 's/'"${prefix1}"'/'"${prefix2}"'/g' $line
        # 替换车编码
#        sed -i.bak -e 's/'"${vehicle1}"'/'"${vehicle2}"'/g' $line
    fi
done